<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <book name="三国演义" author="罗贯中" price="128" url="./imgs/1.jpg" ></book>
        <book url="./imgs/1.jpg" name="四国演义" :author="books[0].author" price="129"></book>
        <hr/>
        <book v-for="item in books" :url="item.url" :name="item.name" :author="item.author" :price="item.price"></book>
        <hr/>
        <book v-for="item in books" v-bind="item"></book>
        <book :person ="p" ></book>
        
    </div>
</body>
</html>
<script src="./js/vue.js"></script>
<script>

    // 书籍详情：
    let book = {
        props:["url","name","author","price","person"],
        template:`
            <div>
                <img :src="url" style="width:200px;height:200px">
                <p>名字：{{name}}</p>
                <p>作者：{{author}}</p>
                <p>价格：{{price}}</p>
            </div>
        `,
        
        data(){
            return {   

            }
        }        
    }   


    let vm = new Vue({
        el:"#app",
        components:{
            book
        },
        data:{
            p:{
                name:"王一星",
                sex:"男"
            },
            books:[
                {
                    url:"./imgs/1.jpg",
                    name:"三国演义",
                    author:"罗贯中",
                    price:125
                },
                {
                    url:"./imgs/2.jpg",
                    name:"三国演义2",
                    author:"罗贯中2",
                    price:128
                },
                {
                    url:"./imgs/3.jpg",
                    name:"三国演义3",
                    author:"罗贯中3",
                    price:129
                }
            ]
        }
        
    });


</script>